﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ShopCD
{
    public partial class frm_Main : Form
    {
        public frm_Main()
        {
            InitializeComponent();
        }
        Boolean flag = true;

        private void danhMụcToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            foreach (Form f in this.MdiChildren)    //chay tat ca cac form con
            {
                if (f is ShopCD.GUI.frm_DanhMuc)  //Neu form listview co roi
                {
                    flag = false;   //gan co la la da co
                    f.Activate();   //Acti len. (hien len tren). (chuyen focus sang form nay)
                    break;
                }
            }

            if (flag)   //neu kiem tra co la chua co
            {
                ShopCD.GUI.frm_DanhMuc f = new GUI.frm_DanhMuc();
                f.MdiParent = this;
                f.Show();
            }
            flag = true;
        }

        private void danhMụcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f in this.MdiChildren)    //chay tat ca cac form con
            {
                if (f is ShopCD.GUI.frm_CayDM)  //Neu form listview co roi
                {
                    flag = false;   //gan co la la da co
                    f.Activate();   //Acti len. (hien len tren). (chuyen focus sang form nay)
                    break;
                }
            }

            if (flag)   //neu kiem tra co la chua co
            {
                ShopCD.GUI.frm_CayDM f = new ShopCD.GUI.frm_CayDM();
                f.MdiParent = this;
                f.Show();
            }
            flag = true;
        }

        private void shopCDToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f in this.MdiChildren)    //chay tat ca cac form con
            {
                if (f is ShopCD.GUI.frm_ShopCD)  //Neu form listview co roi
                {
                    flag = false;   //gan co la la da co
                    f.Activate();   //Acti len. (hien len tren). (chuyen focus sang form nay)
                    break;
                }
            }

            if (flag)   //neu kiem tra co la chua co
            {
                ShopCD.GUI.frm_ShopCD f = new GUI.frm_ShopCD();
                f.MdiParent = this;
                f.Show();
            }
            flag = true;
        }
    }
}
